# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=nlopt
pkgver=2.7.1
pkgrel=8
pkgdesc="Nonlinear optimization library"
arch=(loong64 x86_64)
url="https://nlopt.readthedocs.io/en/latest/"
license=(LGPL)
depends=(gcc-libs)
makedepends=(cmake python-numpy octave guile swig)
optdepends=('python-numpy: to use with python')
source=(https://github.com/stevengj/nlopt/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('db88232fa5cef0ff6e39943fc63ab6074208831dc0031cf1545f6ecd31ae2a1a')

build() {
  cmake -B build -S ${pkgname}-${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr
  make -C build
}

check() {
  cd build
  ctest --output-on-failure
}

package() {
  make -C build DESTDIR="${pkgdir}" install
}
